package com.wkbb.common.dto.course;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@ApiModel("课时dto")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CourseTimeDto implements Serializable {

    @ApiModelProperty(value = "服务名称")
    private String serviceName;
    @ApiModelProperty(value = "服务封面")
    private String logo;
    @ApiModelProperty(value = "服务标识（机构课程uniqueId or 托管uniqueId）")
    private String serviceUniqueId;
    @ApiModelProperty("授课方式 1面授 2双师")
    private Integer serviceType;
    @ApiModelProperty("班级名称")
    private String className;
    @ApiModelProperty("课程分类")
    private String tagName;
    @ApiModelProperty("场地名称")
    private String siteName;
    @ApiModelProperty("授课老师")
    private String teacherName;
    @ApiModelProperty(value = "班级类型 4课程班 5托管班")
    private Integer classType;

    @ApiModelProperty("课时ID")
    private Long id;
    @ApiModelProperty("班级ID")
    private Long classId;
    @ApiModelProperty("课时ID")
    private Long orgId;
    @ApiModelProperty("课时名称")
    private String title;
    @ApiModelProperty("课时开始时间")
    private Date startTime;
    @ApiModelProperty("课时结束时间")
    private Date endTime;
    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("状态 1待上课 2上课中 3已结课")
    private Integer status;
    @ApiModelProperty("是否已请假 1是 0否")
    private Integer haveLeave;
    @ApiModelProperty("是否已反馈 1是 0否")
    private Integer haveFeedBack;

    public Integer getStatus() {
        long currTime = new Date().getTime();
        if (currTime < startTime.getTime()){
            return 1;
        }
        if (currTime < endTime.getTime()){
            return 2;
        }
        return 3;
    }
}
